package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.common.utils.PageUtils;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.dto.NursingProjectDto;
import com.zzyl.nursing.service.IOrdersProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 小程序护理项目列表
 * @author Lenovo
 */
@RestController
@RequestMapping("/member/orders/project")
@Api(tags = "小程序护理项目列表")
@Slf4j
public class MemberOrdersProjectController extends BaseController {
    @Autowired
    private IOrdersProjectService ordersProjectService;

    /**
     * 查询护理项目列表
     * @param nursingProject
     * @return
     */
    @ApiOperation("查询护理项目列表")
    @GetMapping("/page")
    public TableDataInfo page(NursingProject nursingProject,
                              @RequestParam(defaultValue = "1") Integer pageNum,
                              @RequestParam(defaultValue = "10") Integer pageSize){
        log.info("查询护理任务列表");
//        startPage();
        PageUtils.startPage(pageNum,pageSize);
        List<NursingProject> list = ordersProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(list);
    }

    @ApiOperation("查询护理项目详情")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable Long id){
        log.info("查询护理项目详情");
        return success(ordersProjectService.getById(id));
    }



}
